//
//  LBContainViewController.m
//  LBUIKit_Example
//
//  Created by LINAICAI on 2018/6/5.
//  Copyright © 2018年 李柰财. All rights reserved.
//

#import "LBContainViewController.h"
#import "LBWebViewController.h"
@interface LBContainViewController ()

@end

@implementation LBContainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    LBWebViewController *vc = [[LBWebViewController alloc]initUrl:@"https://devm.lianj.com/project/11005" token:@"0630ea9ba3c74f979c87f4638426385e"];
    [vc addAction:[JavaScriptAction actionWithName:@"login" handler:^(WKScriptMessage *message) {
        NSLog(@"message:%@",message.body);
        
    }]];
    [vc addAction:[JavaScriptAction actionWithName:@"share" handler:^(WKScriptMessage *message) {
        NSLog(@"message:%@",message.body);
    }]];
    [vc addAction:[JavaScriptAction actionWithName:@"collection" handler:^(WKScriptMessage *message) {
        NSLog(@"message:%@",message.body);
    }]];
    [vc addAction:[JavaScriptAction actionWithName:@"thumbsUp" handler:^(WKScriptMessage *message) {
        NSLog(@"message:%@",message.body);
    }]];
    [vc addAction:[JavaScriptAction actionWithName:@"enroll" handler:^(WKScriptMessage *message) {
        NSLog(@"message:%@",message.body);
    }]];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [vc evaluateJavaScript:@"triggerShare()"];
    });
    
    [self addChildViewController:vc];
    [self.view addSubview:vc.view];
    vc.view.frame = self.view.bounds;
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
